package com.zyz.testremoteview.activity

import android.annotation.SuppressLint
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.RemoteViews
import com.zyz.testremoteview.R
import com.zyz.testremoteview.service.ForegroundShowService
import com.zyz.testremoteview.utils.WidgetUtil
import com.zyz.testremoteview.widget.AppWidget

class MainActivity : AppCompatActivity() {

    @SuppressLint("MissingInflatedId")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        findViewById<View>(R.id.btn_notify).setOnClickListener {
            ForegroundShowService.launch(this)
        }

        findViewById<View>(R.id.btn_app_widget).setOnClickListener {
            Intent(this, AppWidget::class.java).let {
                it.action = WidgetUtil.REFRASH
                val bundle = Bundle()
                bundle.putString("type", WidgetUtil.ALL_REFRASH)
                it.putExtras(bundle)
                sendBroadcast(it)
            }
        }
    }
}